﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Runtime.Serialization;

namespace ProdeBackEnd.Model
{
    [DataContract(Namespace = "ProdeBackEnd.Model")]
    public class User
    {
        [DataMember]
        private long id;

        [DataMember]
        private String code;

        [DataMember]
        private String name;

        [DataMember]
        private String mail;

        [DataMember]
        private String password;

        [DataMember]
        private List<Tournament> tournaments;

        public User(String code, String name, String mail, String password)
        {
            this.code = code;
            this.name = name;
            this.mail = mail;
            this.password = password;
        }

        public User(long id, String code, String name, String mail, String password)
        {
            this.id = id;
            this.code = code;
            this.name = name;
            this.mail = mail;
            this.password = password;
        }

        public long getId()
        {
            return this.id;
        }

        public String getName()
        {
            return this.name;
        }

        public String getMail()
        {
            return this.mail;
        }

        public String getCode()
        {
            return this.code;
        }

        public String getPassword()
        {
            return this.password;
        }

        public List<Tournament> getTournaments()
        {
            return this.tournaments;
        }

        public void setId(long id)
        {
            this.id = id;
        }

        public void setCode(String code)
        {
            this.code = code;
        }

        public void setName(String name)
        {
            this.name = name;
        }

        public void setMail(String mail)
        {
            this.mail = mail;
        }

        public void setPassword(String password)
        {
            this.password = password;
        }

        public void setTournament(List<Tournament> tournaments)
        {
            this.tournaments = tournaments;
        }

        public void addTournaments(Tournament tournament)
        {
            this.tournaments.Add(tournament);
        }

        public bool isPassEquals(User user)
        {
            if (this.code.Equals(user.getCode()) && this.password.Equals(user.getPassword()))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}